import { getAction } from '@api/manage'
const article = {
  state: {
    articleId: 1,
    articleInfo:{}
  },
  mutations: {
    setArticleId(state,id){
      state.articleId = id
    },
    clearStateArticle(state){
      state.articleInfo = {
        tags: [
        //   {
        //   tagId: "",
        //   tagName: ""
        // }
        ]
      };
    },
  },
  actions: {
    getArticleById({state},id){
      getAction('/blog/blogArticle/blogDetail',  {id} ,'get').then(res =>{
        let data = res.data
        data.tags = data.tags.map(tag => {
          return tag.tagId
        })
        state.articleInfo = data
      })
    }
  }
}
export default article